import * as types from "./mutation-types";
import state, { State, Video } from "./state";


// 添加视频到播放列表
export const mutations = {
    [types.ADD_VIDEO_TO_LIST](state: State, video: any) {
        if (video instanceof Array) {
            state.videoList.push(...video)
        } else {
            state.videoList.push(video)
        }
        console.log(video)
    },
    [types.SET_CURRENT_VIDEO_INDEX](state: State, index: number) {
        state.currentVideoIndex = index
        console.log("set current index: %d", index)
    },
    [types.SET_USER_TOKEN](state: State, userToken: string) {
        state.userToken = userToken
        console.log("set userToken: %s", userToken)
    }
}
